﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;

public class TestHelper : MonoBehaviour
{
    private Dictionary<string, Action> m_Funcs = new Dictionary<string, Action>();

    private void Awake()
    {
        m_Funcs.Add("ShowAlert", ShowAlert);
        m_Funcs.Add("ClearData", () => { PlayerPrefs.DeleteAll(); });
        m_Funcs.Add("ShowBattle", () => { UIManager.Instance.ShowPage(UINames.BattleScene); });
    }

    void OnGUI()
    {
        GUI.skin.button.fontSize = 40;
        foreach (var pair in m_Funcs)
        {
            if (GUILayout.Button(pair.Key))
            {
                if (pair.Value != null)
                {
                    pair.Value();
                }
            }
        }
    }

    private void ShowAlert()
    {
        AlertBubble.Show("bubbleAlert");
    }

    private static TestHelper m_Instance;
    [MenuItem("ArtTools/TestHelper &T")]
    private static void ToggleShow()
    {
        if (m_Instance == null)
        {
            var go = new GameObject("TestHelper");
            m_Instance = go.AddComponent<TestHelper>();
        }
        else
        {
            GameObject.Destroy(m_Instance.gameObject);
            m_Instance = null;
        }
    }
}
